package org.jboss.minstaller

import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.ServletHolder;
import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.Handler;
import org.mortbay.jetty.handler.HandlerList;
import org.mortbay.jetty.handler.DefaultHandler;
import org.mortbay.jetty.handler.ResourceHandler;

import org.jboss.minstaller.util.*;

/**
 * @author jjeon@redhat.com
 *
 */
public class WebServer {
    def serverConfig; 
    
    def server;
    def root; 
    def resourceHandler
    
    public WebServer(config) {
        serverConfig = config;        
    }
    
    public void startServer() {
        server = new Server( serverConfig.getWgetport().asType(Integer) )
        resourceHandler = new ResourceHandler()
        resourceHandler.setResourceBase( "." )
        server.setHandler(resourceHandler)
        server.start()           
    }
    
}